﻿using System.Windows.Forms;
using GeoSketch2.Core;

namespace GeoSketch2.Archaeo
{
    /// <summary>
    /// The toolbar button to switch to an arc section in a polyline
    /// </summary>
    public partial class TBBPolylineArc : BaseToolbarButton
    {
        #region Constructor
        /// <summary>
        /// The toolbar button to switch to an arc section in a polyline
        /// </summary>
        public TBBPolylineArc()
        {
            InitializeComponent();
            ToolTipText = "Arc (3 points)";
        } 
        #endregion

        #region Events
        /// <summary>
        /// The event on the mouse click on the button
        /// </summary>
        protected override void OnMouseClick(object sender, MouseEventArgs e)
        {
            ((TBPolyline)this.Parent).CurrentTool.CurrentVertexType = VertexType.Arc;
            
            foreach (Control tbb in this.Parent.Controls)
            {
                if (tbb.GetType().BaseType == typeof(BaseToolbarButton))//ResSet every other button
                {
                    ((BaseToolbarButton)tbb).LeftButtonClicked = false;
                    ((BaseToolbarButton)tbb).RightButtonClicked = false;
                    tbb.Invalidate();
                }
            }

            LeftButtonClicked = true;
            RightButtonClicked = true;
            this.Invalidate();
        }
        #endregion
    }
}
